<div class="x-list-title">
<table width="100%" border="0" height="100%">
<tr><td align="left">
	<h2><?php _e($title)?></h2>
</td><td align="right">	
<?php $id = getId();?>
<div class="x-list-options">
	<div class="x-pop">
		<form action="<?php _baseUrl()?>/Project/Search" onsubmit="return ajax_form(this,true)">
		<div class="simple-search">
			<input type="text" name="s" class="s" autocomplete="off" spellcheck="false" placeholder="Tìm kiếm"/>
			<button class="b"></button>
		</div>
		</form>
	</div>	
	<a href="#Project/Index/Add" class="x-button">Dự án mới</a>
	<div class="x-options-container">
		<a class="x-button">Tác vụ khác <span>&#9660;</span></a>
		<div class="x-options">
			<a class="x-options-item" href="#Project/Search/Form">Tìm kiếm nâng cao</a>		
			<a class="x-options-item" onclick="module_ajax('<?php _baseUrl()?>/Project/Act?act=unread','f<?php _e($id);?>',this)">Đánh dấu chưa đọc</a>
			<a class="x-options-item" onclick="module_ajax('<?php _baseUrl()?>/Project/Act?act=read','f<?php _e($id);?>',this)">Đánh dấu đã đọc</a>
			<a class="x-options-item" onclick="module_delete('<?php _baseUrl()?>/Project/Act/Delete?url=<?php _e(rawurlencode('Project/'.$this->controller.'/'.$this->action));?>','f<?php _e($id);?>',this)">Xóa đã chọn</a>
			<a class="x-options-item" onclick="module_ajax('<?php _moduleUrl($this);?>/Act/Remind','f<?php _e($id);?>',this)">Gửi nhắc nhở</a>			
			<a class="x-options-item" onclick="module_frame('<?php _baseUrl()?>/Project/Export','f<?php _e($id);?>',this)">Xuất ra file Exel</a>
		</div>
	</div>
</div>

</td></tr></table>	
</div>
<?php $vars = $this->get('vars');?>
<?php
$vars = $this->get('vars');
$link = '#'.$this->getModule()."/".$this->getController()."/".$this->getAction();
?>
<form id="f<?php _e($id);?>">
<table width="100%" class="x-list" cellpadding="0" cellspacing="0">
<tr>
	<th align="center" width="25">
	TT
	</th>
	<th width="20" align="center">
		CB
	</th>	
	<th align="center" width="70">
		<?php show_order_link('Mã','code',$link,$vars) ;?>
	</th>
	<th align="center">
		<?php show_order_link('Dự án','title',$link,$vars) ;?>
	</th>
	<th align="center" width="120">
		<?php show_order_link('Trạng thái','status',$link,$vars) ;?>
	</th>
	<th align="center" width="80">
		<?php show_order_link('Tiến độ','rate',$link,$vars) ;?>
	</th>
	<th align="center" width="100">
		<?php show_order_link('Bắt đầu','date_start',$link,$vars) ;?>
	</th>
	<th align="center" width="100">
		<?php show_order_link('Kết thúc','date_end',$link,$vars) ;?>
	</th>
	<th align="center" width="100">
		<?php show_order_link('Hoàn thành','date_end_forecast',$link,$vars) ;?>
	</th>
	<th align="center" colspan="2">Tác vụ</th>
	<th align="center" width="25">
		<div class="x-check-container">
			<div class="x-check">
			<input type="checkbox" class="x-checkbox x-checkall"/>
			</div>
			<div class="x-check-options">
				<a class="x-check-item check-all">Chọn tất cả</a>
				<a class="x-check-item uncheck-all">Bỏ chọn</a>
				<a class="x-check-item check-unread">Chọn chưa đọc</a>
				<a class="x-check-item check-read">Chọn đã đọc</a>
				<a class="x-check-item" onclick="$(this).parent(4).find('tr.task-warn input.x-checkbox').set('checked',true)">Chọn quá hạn</a>				
			</div>
		</div>
	</th>
</tr>
<?php if( count($this->get("posts")) > 0 ): ?>
<?php foreach( $this->get("posts") as $k => $a ): ?>
	<?php 
		$cb ='';$rb='';
		if( $a['status'] == 'active' && $a['date_end_forecast'] ) :?>	
	<?php
		$ul = " onclick='ajax_load(\"".baseUrl()."/Project/Index/Remind?ID={$a['ID']}\")'";
		$time  = strtotime( $a['date_end_forecast'] );
		$ins   = $time - time();
		if( $ins >= 0 ){
			if( $ins/60 < 60 ){
				$cb = ("<a $ul class='pin2' title='Còn ".round($ins/60)." phút'></a>");
			}else if( $ins/3600 < 24 ){
				$cb = ("<a $ul class='pin2' title='Còn ".round($ins/3600)." tiếng'></a>");
			}else{
				$cb = ("<a $ul class='pin1' title='Còn ".round($ins/(24*3600))." ngày'></a>");
			}		
		}else if( $ins < 0 ){
			$rb = ' task-warn';
			if( $ins/60 > -60 ){
				$cb = ("<a $ul class='pin3' title='Quá hạn ".round(-1*$ins/60)." phút'></a>");
			}else if( $ins/3600 > -24 ){
				$cb = ("<a $ul class='pin3' title='Quá hạn ".round(-1*$ins/3600)." tiếng'></a>");
			}else{
				$cb = ("<a $ul class='pin3' title='Quá hạn ".round(-1*$ins/(24*3600))." ngày'></a>");
			}		
		}		
	?>
	<?php else:?>
	<?php 
		$cb ='<a class="no-pin"></a>';		
	?>
	<?php endif;?>
<tr class="<?php _e($a['is_read']=='yes' ? 'x-read':'x-noread');_e($rb); ?>">
<td align="center">
	<?php _e($k+1);?>
</td>
<td align="center">
	<?php _e($cb);?>
</td>
<td align="center">
	<?php _e($a['code']);?>
</td>
<td>
	<a href="#Project/Index/View?ID=<?php _e($a['ID']);?>"><?php _e(short_title($a['title'],$a['is_read']=='yes' ? 34 : 32));?></a>
</td>
<td align="center">
	<?php _e(get_status($a['status']));?>
</td>
<td align="center">
	<?php _e($a['rate']);?> %
</td>
<td align="center">
	<?php _e(show_date(DATE_FORMAT,$a['date_start']));?>
</td>
<td align="center">
	<?php _e(show_date(DATE_FORMAT,$a['date_end_forecast']));?>
</td>
<td align="center">
	<?php _e(show_date(DATE_FORMAT,$a['date_end']));?>
</td>
<td align="center" width="25">
	<?php if( $a['created_by_id'] == get_user_id() ):?>
	<a onclick="module_delete('<?php _baseUrl()?>/Project/Index/Delete?ID=<?php _e($a['ID'])?><?php _e($qr_cat)?>')" class="x-delete"></a>
	<?php else:?>
	<a class="x-nodelete"></a>
	<?php endif;?>
</td>
<td align="center" width="25">
	<?php if( $a['created_by_id'] == get_user_id() ):?>
	<a href="#Project/Index/Edit?ID=<?php _e($a['ID'])?>" class="x-edit"></a>
	<?php else:?>
	<a class="x-noedit"></a>
	<?php endif;?>
</td>
<td align="center">
	<input name="ID[]" value="<?php _e($a['ID'])?>" type="checkbox" class="x-checkbox x-checkall"/>
</td>
</tr>
<?php endforeach;?>
<tr>
	<td colspan="12" class="page">
	<div class="x-page">
		<?php $this->e("page");?>
	</div>		
	</td>
</tr>
<?php else:?>
<tr>
	<td colspan="12" class="page"><div class="x-page">
			Không có dự án nào được tìm thấy
		</div>
	</td>
</tr>
<?php endif;?>
</table></form>
